<template>
<div class="container__">
    <div class="goodsitem" @click="routerTo" v-for="(item, index) in list" :key="index">
        <div class="zhuangrtai">
            <span>{{item.content.title}}</span>
            <h3>查看详情</h3>
        </div>
        <div class="shooping">
            <div class="thumb">
              <img :src="item.content.thumb" alt="">
            </div>
            <div class="infobox">
                <div class="top_">{{item.content.content}}</div>
                <div class="mid_"><span class="jifen">{{item.content.price}}</span> <span class="num">x{{item.content.num}}</span></div>
                <div class="bot_">{{item.created_at}}</div>
            </div>
        </div>
    </div>
</div>
</template>

<script>
import {getsys} from '@/api/msg'
export default {
    data() {
        return {
            list:[],
            page:1,
            lastpage:'',
        }
    },
    methods: {
        routerTo(){
              wx.navigateTo({
                url: '/pages/courseDetails/main'
            })
        },
        getlist(){
            getsys({page:this.page}).then(res=>{
                this.last_page=res.data.last_page
                if(this.page==1){
                    this.list=res.data.data
                }else{
                    this.list=this.list.concat(res.data.data)
                }
            })
        }
    },
     onReachBottom: function () {
        setTimeout(() => {
            this.page += 1
            if (this.page > this.last_page) return 
            this.getlist()
        },1000)

    },
    onLoad(){
        Object.assign(this.$data, this.$options.data())
         this.page=1
        this.getlist()
    }
}
</script>

<style lang="scss">
.container__ {
    font-size: 14px;
    min-height: 100vh;
    padding: 20px 0;
    box-sizing: border-box;
    background-color: #F4F5F5;
    display: flex;
    flex-direction: column;
    align-items: center;

    .goodsitem {
        min-height: 141px;
        width: 345px;
        background-color: #fff;
        border: 1px solid rgba(221, 221, 221, 1);
        border-radius: 5px;
        display: flex;
        flex-direction: column;
        justify-content: space-around;
        box-sizing: border-box;
        padding: 0 15px;
        margin-bottom:15px;
        .zhuangrtai {
         
            display: flex;
            justify-content: space-between;
            align-items: flex-end;

            h3 {
                color: #1A84FB;
                font-size: 12px;
            }

            span {
                color: #333;
                font-size: 15px;
                font-weight: bold;
            }
        }

        .shooping {
            display: flex;
            justify-content: space-between;

            .thumb {
                height: 78px;
                width: 109px;
               img{
                 width: 100%;
                 height: 100%;
               }
            }

            .infobox {
                width: 194px;
                display: flex;
                flex-direction: column;
                justify-content: space-between;

                .top_ {
                    max-height: 32px;
                    overflow: hidden;
                    line-height: 16px;
                    font-size: 14px;
                    font-weight: 500;
                    color: rgba(51, 51, 51, 1);
                }

                .mid_ {
                    display: flex;
                    justify-content: space-between;
                    align-items: flex-end;

                    .jifen {
                        color: #E9B55E;
                        font-size: 15px;
                    }

                    .num {
                        font-size: 12px;
                    }
                }

                .bot_ {
                    font-size: 12px;
                    font-weight: 500;
                    color: #DDDDDD;
                }
            }
        }
    }
}
</style>
